/// @tags:
#include <cstdio>
#include <functional>
#include <iostream>
#include <numeric>

using std::cin, std::cout, std::endl;

namespace BlueQuantum {

constexpr int maxn = 100;

int a[maxn];

int main() {
  int t;
  cin >> t;
  while (t--) {
    int n, k;
    cin >> n >> k;
    bool no0 = true, no1 = true;
    for (int i = 1; i <= n; ++i) {
      cin >> a[i];
      if (a[i] == 0) no0 = false;
      if (a[i] == 1) no1 = false;
    }
    if (no1) {
      cout << "NO\n";
    } else {
      cout << "YES\n";
    }
  }
  return 0;
}

}  // namespace BlueQuantum

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("/tmp/CodeTmp/testdata.in", "r", stdin);
  freopen("/tmp/CodeTmp/testdata.out", "w", stdout);
#else
  freopen("A. Maxmina.in", "r", stdin);
  freopen("A. Maxmina.out", "w", stdout);
#endif
#endif

  std::ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  return BlueQuantum::main();
}
